package com.sun.service;

import com.sun.model.Dept;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

/**
 * Feign是接口提供负载均衡的
 */

@FeignClient(value = "SPRINGCLOUD-PROVIDER-DEPT",fallbackFactory = DeptClientServerFallBackFactory.class)
@Component
public interface DeptClientServer {

    @GetMapping("/dept/get/{id}")
    public Dept queryDeptById(@PathVariable("id") int id);

    @GetMapping("/dept/getAll")
    public List<Dept> queryAll();

    @PostMapping("/dept/add")
    public boolean addDept(Dept dept);
}
